<?php
namespace Core;

use Core\Container;
use Core\Request;
use Core\Response;

abstract class Controller {
    protected $container;
    
    public function __construct(Container $container) {
        $this->container = $container;
    }
    
    protected function json($data, $status = 200) {
        return Response::make()
            ->status($status)
            ->json([
                'success' => $status >= 200 && $status < 300,
                'data' => $data,
                'timestamp' => time()
            ]);
    }
    
    protected function error($message, $status = 400, $details = []) {
        return $this->json([
            'message' => $message,
            'details' => $details
        ], $status);
    }
}